package com.example.schoolexam2.mapper;

import com.example.schoolexam2.entity.PageVO;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface PageMapper {

    List<PageVO> selectPagesByConditions( String pname);
    int getPageCount(String pname);

    @Insert("insert into tb_pages (pname,mid,purl,picon) values(#{pname},(select mid from tb_modules where 1=1 and mname=#{pmodule}),#{purl},#{picon})")
    int addPage(PageVO page);

    @Update("update tb_pages set pname=#{pname},mid=(select mid from tb_modules where 1=1 and mname=#{pmodule}),purl=#{purl},picon=#{picon} where 1=1 and pid=#{pid}")
    int updatePage(PageVO page);

    @Delete("delete from tb_pages where pid=#{pid}")
    int deletePage(PageVO page);
}
